/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 29489
 * Date: 2023-03-16
 * Time: 14:41
 */
public class Person {
    private String name;
    private boolean gender;
    private int age;
    private int id;

    static
    {
        System.out.println("This is static initialization block");
    }

    public static int tmpId = 0;

    public Person(){
        System.out.println("This is constructor");
        System.out.println(name+","+age+","+gender+","+id);
        ++tmpId;
    }
    public Person(String name, int age, boolean gender){
        this.name = name;
        this.gender = gender;
        this.age = age;
        ++tmpId;
    }
    {
        id = tmpId;
        System.out.println("This is initialization block, id is "+id);
    }

    @Override
    public String toString() {
        return "Person [" +
                "name=" + name +
                ", age=" + age +
                ", gender=" + gender +
                ", id=" + id +
                ']';
    }
    public void print(){
        System.out.println(toString());
    }
}
